<script type="text/javascript">
    function upload_success(file, data) {
        var json = $.parseJSON(data)

        $(this).bjuiajax('ajaxDone', json)
        if (json[BJUI.keys.statusCode] == BJUI.statusCode.ok) {
//            var datas = json.datas;
//            $('#datagrid-table').datagrid({
//                filterThead:false,
//                paging:false,
//                columns: [{name:'id', width:'150', label:'构件ID',hide:true}, {name:'name', label:'文件名',width:'500'}, {name:'size', label:'文件大小',width:'300'}],
//                data: datas
//            })
            $('#artifactName_').val(json.originalName);
            $('#artifactId_').val(json.artifactId);
        }
        else
        {
            $(this).alertmsg('error', error.msg)
        }
    }

</script>
<div class="bjui-pageContent">
    <form action="${wwwroot}/admin/prescript/save" id="editForm" data-toggle="validate" data-alertmsg="false" reloadNavtab="true">
        <input type="hidden" name="id" value="${(preScript.id)!}" />
        <div class="pageFormContent" data-layout-h="0">
            <table class="table table-condensed table-hover" width="100%">
                <tbody>
                <tr>
                    <td>
                        <label class="control-label x85">上传脚本：</label>
                        <div style="display: inline-block; vertical-align: middle;">
                            <div id="j_file_up" data-toggle="upload" data-uploader="${wwwroot}/admin/artifact/upload"
                                 data-file-size-limit="1024000000"
                            <#--data-file-type-exts="*.sql;*.jpg"-->
                                 data-file-type-exts="<#list uploadFormats as format>*.${(format.format)!};</#list>"
                                 data-multi="true"
                                 data-auto="true"
                                 data-dragDrop="true"
                                 data-on-upload-success="upload_success"
                                 data-icon="cloud-upload"></div>
                        </div>
                    </td>
                </tr>
                    <tr>
                        <#--<td>-->
                            <#--<label for="artifactId" class="control-label x85">构件ID：</label>-->
                            <#--<input type="text" name="artifactId" id="artifactId" value="${(preScript.artifactId)!}" data-rule="required" >-->
                        <#--</td>-->
                        <td>
                            <label for="artifactName" class="control-label x85">脚本名称：</label>
                            <input type="text" name="artifactName" id="artifactName_" value="${(preScript.artifactName)!}" data-rule="required" readonly>
                            <input type="hidden" name="artifactId" id="artifactId_" value="">
                        </td>

                        <td>
                            <label for="storePath" class="control-label x85">存储路径：</label>
                            <input type="text" name="storePath" id="storePath" value="${(preScript.storePath)!}" data-rule="required" >
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <label for="storeName" class="control-label x85">存储名称：</label>
                            <input type="text" name="storeName" id="storeName" value="${(preScript.storeName)!}" data-rule="required" >
                        </td>
                        <td>
                            <label for="note" class="control-label x85">备注：</label>
                            <input type="text" name="note" id="note" value="${(preScript.note)!}"  >
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </form>
</div>
<div class="bjui-pageFooter" >
    <ul>
        <li><button type="button" class="btn btn-close" data-icon="close">取消</button></li>
        <li><button type="submit" class="btn btn-success" data-icon="save">保存</button></li>
    </ul>
</div>
